import ApiConfig from "./api-config";
import axios from "axios";

/**
 * 接口列表文件
 * @property {String} 项目模块
 * 		@value {Object} 模块具体功能
 * 			@value {String} url 接口具体地址
 * 			@value {Boolean} auth 是否需要带token
 * 			@value {String} method 请求方法GET/POST/OPTIONS/DELETE等
 * 			@value {Object} requestHeaders 请求头参数（headers，dataType custom，timeout，sslVerify）
 */

export default {
	common: {
		dictValueType: {
			url: `${ApiConfig.shopBasicUrl}/common/dictValue`,
			auth: false,
			method: "GET",
			desc: "字典值列表获取",
		},
		upload: {
			url: `${ApiConfig.shopBasicUrl}/common/upload`,
			auth: true,
			method: "POST",
			desc: "文件上传通用接口",
		},
		uploadFile: (params, header = {}) =>
			axios.post(`${ApiConfig.shopBasicUrl}/common/upload`, params, {
				headers: {
					"Content-Type": "multipart/form-data",
                    ...header
				},
			}),
	}
};
